package dao;
import java.util.*;
import java.sql.*;
import entity.Profile;
public class markDao extends BaseDao {
    public List<Profile> getAllPro(){
    List<Profile> list = new ArrayList<Profile>();
    Connection conn = super.getConn();
    PreparedStatement ps = null;
    ResultSet rs =null;
    try {
        String sql = "select * from mark";
        ps = conn.prepareStatement(sql);
        rs = ps.executeQuery();
        while (rs.next()){
            Profile pf = new Profile();
            pf.setId(rs.getInt("id"));
            pf.setMarkTitle(rs.getString("markTitle"));
            pf.setMarkURL(rs.getString("markURL"));
            pf.setMarkType(rs.getString("markType"));
            list.add(pf);
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }finally {
        super.closeAll(conn,ps,rs);
    }
    return list;
    }
    public int deleteById(int id){
        int row =0;
        Connection conn =super.getConn();
        PreparedStatement ps =null;
        String sql = "delete from mark where id = ?";
        try{
            ps=conn.prepareStatement(sql);
            ps.setInt(1,id);
            row = ps.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            super.closeAll(conn,ps,null);
        }
        return row;
    }
}
